﻿using System;
using System.Collections.Generic;
using System.Text;
using Silvermoon.UI;
using Silvermoon.Windows;
using System.Drawing;

namespace Silvermoon.Controls
{
    public static class ToggleButtonManagers
    {

        public static readonly VisualStateManager JumpToggleButtonManager = new VisualStateManager(
            Control.ColorDisabledEnabledGroup,
            ButtonStateManagers.NormalPressedButtonGroup,
            new VisualStateGroup(
                new VisualState(VState.Unchecked,
                    new ColorTransition
                    {
                        To = PhoneColors.MediumDark,
                        Duration = 300,
                        Tracking = TrackMode.Keep
                    },
                    new PointFTransition
                    {
                        Property = ToggleButton.OnOffsetProperty,
                        To = new PointF(0, 1f),
                        Duration = 300,
                        Tracking = TrackMode.Keep
                    },
                    new PointFTransition
                    {
                        Property = ToggleButton.OffOffsetProperty,
                        To = PointF.Empty,
                        Duration = 300,
                        Tracking = TrackMode.Keep
                    }
                    ),
                new VisualState(VState.Checked,
                     new ColorTransition
                     {
                         To = PhoneColors.Accent,
                         Duration = 300,
                         Tracking = TrackMode.Keep
                     },

                    new PointFTransition
                    {
                        Property = ToggleButton.OnOffsetProperty,
                        To = PointF.Empty,
                        Duration = 300,
                        Tracking = TrackMode.Keep

                    },
                    new PointFTransition
                    {
                        Property = ToggleButton.OffOffsetProperty,
                        To = new PointF(0, -1f),
                        Duration = 300,
                        Tracking = TrackMode.Keep

                    }
                    )
                )
            );


        public static readonly VisualStateManager ToggleButtonManager = new VisualStateManager(
            Control.ColorDisabledEnabledGroup,
            ButtonStateManagers.NormalPressedButtonGroup,
                new VisualStateGroup(
                    new VisualState(VState.Unchecked,
                        new ColorTransition
                        {
                            To = PhoneColors.MediumDark,
                            Duration = 300,
                            Tracking = TrackMode.Keep
                        },
                        new IntTransition
                        {
                            Property = ToggleButton.OnOpacityProperty,
                            To = 0,
                            Duration = 300,
                            Tracking = TrackMode.Keep
                        },
                        new IntTransition
                        {
                            Property = ToggleButton.OffOpacityProperty,
                            To = 255,
                            Duration = 300,
                            //Delay = 50,
                            Tracking = TrackMode.Keep
                        }
                        ),
                    new VisualState(VState.Checked,
                        new ColorTransition
                        {
                            To = PhoneColors.Accent,
                            Duration = 300,
                            Tracking = TrackMode.Keep
                        },
                        new IntTransition
                        {
                            Property = ToggleButton.OnOpacityProperty,
                            To = 255,
                            Duration = 300,
                            //Delay = 50,
                            Tracking = TrackMode.Keep

                        },
                        new IntTransition
                        {
                            Property = ToggleButton.OffOpacityProperty,
                            To = 0,
                            Duration = 300,
                            Tracking = TrackMode.Keep
                        }
                        )
                    )
                );
    }
}
